<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
    <title> - 天地维杰网</title>
    <meta name="keywords" content="系统架构,shutdown,不与天斗,Domino,博客,程序员,架构师,笔记,技术,分享,java,Redis">
    
    <meta property="og:title" content="">
    <meta property="og:site_name" content="天地维杰网">
    <meta property="og:image" content="/img/author.jpg"> 
    <meta name="title" content=" - 天地维杰网" />
    <meta name="description" content="天地维杰网 | 博客 | 软件 | 架构 | Java "> 
    <link rel="shortcut icon" href="http://www.shutdown.cn/img/favicon.ico" />
    <link rel="apple-touch-icon" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link rel="apple-touch-icon-precomposed" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link href="http://www.shutdown.cn/js/vendor/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/js/vendor/fancybox/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/css/main.css" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/css/syntax.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
     fancybox: true, 
    motion: true
  };
</script>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container one-collumn sidebar-position-left page-home  ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"> <div class="site-meta  custom-logo ">

  <div class="custom-logo-site-title">
    <a href="http://www.shutdown.cn"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">天地维杰网</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">人如秋鸿来有信，事若春梦了无痕</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
    <ul id="menu" class="menu">
      
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/redis/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-battery-full"></i> <br />Redis
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/java/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-coffee"></i> <br />java
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/linux/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-linux"></i> <br />linux
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/daily/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bug"></i> <br />日常问题
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/spring/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-child"></i> <br />Spring和Springboot
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/spring/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-fire"></i> <br />Mac相关
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/middleware/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-gavel"></i> <br />中间件
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jiagou/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-rocket"></i> <br />架构
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/python/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-ship"></i> <br />python
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/front/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bolt"></i> <br />前端
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jvm/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-balance-scale"></i> <br />JVM
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/post/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/about/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于
          </a>
        </li>
      
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger"> <i class="menu-item-icon fa fa-search fa-fw"></i> <br /> 搜索</a>
      </li>
    </ul>
    <div class="site-search">
      <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>

    </div>
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
<section id="posts" class="posts-expand">
  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/kafka%E6%97%A5%E5%BF%97%E9%87%87%E9%9B%86%E9%85%8D%E7%BD%AE%E8%AE%B0%E5%BD%95/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">424 字 ~2分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    

    

<h1 id="kafka日志采集配置记录">kafka日志采集配置记录</h1>

<blockquote>
<p>背景：公司采购的一套第三方应用，部署在阿里云上，因为第三方有权限登录该服务器，所以不能将该服务器与公司的内网生产服务器进行打通 ，不能直接接入公司内网的已有的日志采集功能中，现在要想办法将该应用的日志采集到公司的日志采集中。</p>
</blockquote>

<div  align="center"><img src="https://wejack639.oss-cn-beijing.aliyuncs.com/blogimages/img/1624527523743-20210624173842.png" width = 800 /> </div>

<p>​        出于安全原因，公司的内网服务器的端口不能向阿里云服务器开放，google查了下文档，可以filebeat可以安装output.http插件，支持http请求的输出，公司的应用可以配置公网的域名，提供http接口给予阿里云上的filebeat进行调用 ，所以初步定的原型如下图。</p>

<div  align="center"><img src="https://wejack639.oss-cn-beijing.aliyuncs.com/blogimages/img/1624594163928-20210625120922.png" width = 800 /> </div>

<p>这里需要将filebeat首先要安装一个插件，然后重新打包才行，因为原生的filebeat是不支持output.http的。filebeat的github地址是</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">beats % git remote -v
origin  https://github.com/elastic/beats <span style="color:#ce5c00;font-weight:bold">(</span>fetch<span style="color:#ce5c00;font-weight:bold">)</span>
origin  https://github.com/elastic/beats <span style="color:#ce5c00;font-weight:bold">(</span>push<span style="color:#ce5c00;font-weight:bold">)</span></code></pre></div>
<p>将项目下载到本地，切换版本到7.13版本的分支</p>

<p>参考文档 <a href="https://github.com/crazygreenpenguin/beats-output-http">https://github.com/crazygreenpenguin/beats-output-http</a> 进行插件的安装配置，这个项目的beats-output-http是针对filebeat v7以上版本的，虽然公司使用的filebeat版本是5.1.6，但是因为其相应的  <a href="https://github.com/raboof/beats-output-http">https://github.com/raboof/beats-output-http</a>  beats-output-http插件配置好以后，使用go打包时，总是不成功。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"><span style="color:#204a87;font-weight:bold">package</span> <span style="color:#000">main</span>

<span style="color:#204a87;font-weight:bold">import</span> <span style="color:#000;font-weight:bold">(</span>
	<span style="color:#4e9a06">&#34;os&#34;</span>
		<span style="color:#8f5902;font-style:italic">//这里配置插件的github地址
</span><span style="color:#8f5902;font-style:italic"></span>    <span style="color:#000">_</span> <span style="color:#4e9a06">&#34;github.com/crazygreenpenguin/beats-output-http&#34;</span>
	<span style="color:#4e9a06">&#34;github.com/elastic/beats/v7/filebeat/cmd&#34;</span>
	<span style="color:#000">inputs</span> <span style="color:#4e9a06">&#34;github.com/elastic/beats/v7/filebeat/input/default-inputs&#34;</span>
<span style="color:#000;font-weight:bold">)</span>

<span style="color:#8f5902;font-style:italic">// The basic model of execution:
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// - input: finds files in paths/globs to harvest, starts harvesters
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// - harvester: reads a file, sends events to the spooler
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// - spooler: buffers events until ready to flush to the publisher
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// - publisher: writes to the network, notifies registrar
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// - registrar: records positions of files read
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// Finally, input uses the registrar information, on restart, to
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#8f5902;font-style:italic">// determine where in each file to restart a harvester.
</span><span style="color:#8f5902;font-style:italic"></span><span style="color:#204a87;font-weight:bold">func</span> <span style="color:#000">main</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span> <span style="color:#000;font-weight:bold">{</span>
	<span style="color:#204a87;font-weight:bold">if</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">:=</span> <span style="color:#000">cmd</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Filebeat</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000">inputs</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Init</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000">cmd</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">FilebeatSettings</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span><span style="color:#000;font-weight:bold">)</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Execute</span><span style="color:#000;font-weight:bold">(</span><span style="color:#000;font-weight:bold">)</span><span style="color:#000;font-weight:bold">;</span> <span style="color:#000">err</span> <span style="color:#ce5c00;font-weight:bold">!=</span> <span style="color:#204a87;font-weight:bold">nil</span> <span style="color:#000;font-weight:bold">{</span>
		<span style="color:#000">os</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">Exit</span><span style="color:#000;font-weight:bold">(</span><span style="color:#0000cf;font-weight:bold">1</span><span style="color:#000;font-weight:bold">)</span>
	<span style="color:#000;font-weight:bold">}</span>
<span style="color:#000;font-weight:bold">}</span></code></pre></div>
<p>​        配置好以后，执行<code>go build</code>命令进行打包，这里要注意，因为我打包的filebeat应用是要在CENTOS系统里运行的，所以打包的命令不能直接使用<code>go build</code>，而要使用如下命令指定运行环境。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go"><span style="color:#000">env</span> <span style="color:#000">GOOS</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000">linux</span> <span style="color:#000">GOARCH</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000">amd64</span> <span style="color:#204a87;font-weight:bold">go</span> <span style="color:#000">build</span> <span style="color:#ce5c00;font-weight:bold">-</span><span style="color:#000">o</span> <span style="color:#000">指定文件名</span> <span style="color:#000">main</span><span style="color:#000;font-weight:bold">.</span><span style="color:#204a87;font-weight:bold">go</span></code></pre></div>
<p>​        如果执行<code>go build</code>的过程中下载慢，则可以参考文档：<a href="https://blog.csdn.net/qq_43442524/article/details/104900180">https://blog.csdn.net/qq_43442524/article/details/104900180</a> 配置go下载的代理。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go">	<span style="color:#204a87;font-weight:bold">go</span> <span style="color:#000">env</span> <span style="color:#ce5c00;font-weight:bold">-</span><span style="color:#000">w</span> <span style="color:#000">GO111MODULE</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000">on</span>
	<span style="color:#204a87;font-weight:bold">go</span> <span style="color:#000">env</span> <span style="color:#ce5c00;font-weight:bold">-</span><span style="color:#000">w</span> <span style="color:#000">GOPROXY</span><span style="color:#000;font-weight:bold">=</span><span style="color:#000">https</span><span style="color:#000;font-weight:bold">:</span><span style="color:#ce5c00;font-weight:bold">/</span><span style="color:#ce5c00;font-weight:bold">/</span><span style="color:#000">goproxy</span><span style="color:#000;font-weight:bold">.</span><span style="color:#000">cn</span><span style="color:#000;font-weight:bold">,</span><span style="color:#000">direct</span></code></pre></div>
<p>执行后就会生成filebeat的执行文件了。接下来我们要在阿里云服务器上面运行这个filebeat的执行文件。将filebeat执行文件上传到阿里云服务器上的 <code>filebeat</code> 目录中。<code>filebeat</code>目录中至少应当有这些文件和目录。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-fallback" data-lang="fallback">data
fields.yml
filebeat
filebeat.reference.yml
filebeat.yml
kibana
logs
module
modules.d</code></pre></div>
<p>​       然后可以配置filebeat的配置文件 filebeat.yml，<a href="https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html">filebeat配置官方文档</a>，我的配置内容文件如下，要注意的一点是配置文件不要用<code>tab</code> 进行缩进，要老老实实的</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yml" data-lang="yml"><span style="color:#204a87;font-weight:bold">filebeat.inputs</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span>- <span style="color:#204a87;font-weight:bold">type</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>log<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">enabled</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">paths</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">  	</span><span style="color:#8f5902;font-style:italic"># 需要采集的文件路径，支持 *匹配</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">    </span>- /apps/srv/instance/my-app/logs/info.log<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">multiline.pattern</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>^\<span style="color:#000;font-weight:bold">[</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">multiline.negate</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">multiline.match</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>after<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">multiline.timeout</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>10s<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">ignore_older</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>10m<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">close_inactive</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>3m<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">close_renamed</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">close_removed</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">scan_frequency</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>1m<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">tail_files</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">harvester_limit</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">20480</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">processors</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">  </span>- <span style="color:#204a87;font-weight:bold">drop_fields</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">      </span><span style="color:#204a87;font-weight:bold">fields</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#000;font-weight:bold">[</span><span style="color:#4e9a06">&#34;prospector&#34;</span><span style="color:#000;font-weight:bold">]</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">queue</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">mem</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">    </span><span style="color:#204a87;font-weight:bold">events</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">10240</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">    </span><span style="color:#204a87;font-weight:bold">flush.min_events</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">2048</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">    </span><span style="color:#204a87;font-weight:bold">flush.timeout</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>5s<span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic">#真实使用配置参考地址 https://github.com/crazygreenpenguin/beats-output-http</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">output.http</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">	</span><span style="color:#8f5902;font-style:italic"># 输出的请求地址</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">url</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;http://mydomain.com/info-direct&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">max_retries</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">0</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># 请求超时时间，这个很重要，默认是100</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">response_header_timeout</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">2000</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic">#调试用，可以看到filebeat输出的消息体</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic">#output.console:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#8f5902;font-style:italic">#  pretty: true</span></code></pre></div>
<p>然后创建启动脚本和停止脚本</p>

<ul>
<li>启动脚本 <code>restart.sh</code></li>
</ul>

<p>启动filebeat的命令是 filebeat -e -c 配置文件</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#8f5902;font-style:italic">#!/bin/bash
</span><span style="color:#8f5902;font-style:italic"></span>
<span style="color:#000">ID</span><span style="color:#ce5c00;font-weight:bold">=</span>filebeat
ps -ef <span style="color:#000;font-weight:bold">|</span> grep yml <span style="color:#000;font-weight:bold">|</span> grep <span style="color:#000">$ID</span> <span style="color:#000;font-weight:bold">|</span> awk -F <span style="color:#4e9a06">&#39; &#39;</span> <span style="color:#4e9a06">&#39;{print $2}&#39;</span> <span style="color:#000;font-weight:bold">|</span> xargs <span style="color:#204a87">kill</span> -9 2&gt;/dev/null<span style="color:#000;font-weight:bold">;</span>
<span style="color:#204a87">echo</span> <span style="color:#4e9a06">&#34;</span><span style="color:#4e9a06">${</span><span style="color:#000">ID</span><span style="color:#4e9a06">}</span><span style="color:#4e9a06">已终止,正在重启..</span><span style="color:#4e9a06">&#34;</span>
nohup /usr/local/instance/filebeat-7/filebeat -e -c /usr/local/instance/filebeat-7/filebeat.yml &gt;&gt; /usr/local/instance/filebeat-7/logs/filebeat.log  2&gt;<span style="color:#000;font-weight:bold">&amp;</span><span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#000;font-weight:bold">&amp;</span></code></pre></div>
<ul>
<li><p>停止脚本<code>stop.sh</code></p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#8f5902;font-style:italic">#!/bin/bash
</span><span style="color:#8f5902;font-style:italic"></span>
<span style="color:#000">ID</span><span style="color:#ce5c00;font-weight:bold">=</span>filebeat
ps -ef <span style="color:#000;font-weight:bold">|</span> grep yml <span style="color:#000;font-weight:bold">|</span> grep <span style="color:#000">$ID</span> <span style="color:#000;font-weight:bold">|</span> awk -F <span style="color:#4e9a06">&#39; &#39;</span> <span style="color:#4e9a06">&#39;{print $2}&#39;</span> <span style="color:#000;font-weight:bold">|</span> xargs <span style="color:#204a87">kill</span> -9 2&gt;/dev/null<span style="color:#000;font-weight:bold">;</span>
<span style="color:#204a87">echo</span> <span style="color:#4e9a06">&#34;</span><span style="color:#4e9a06">${</span><span style="color:#000">ID</span><span style="color:#4e9a06">}</span><span style="color:#4e9a06">已终止</span><span style="color:#4e9a06">&#34;</span></code></pre></div></li>
</ul>

<p>​       为了获取接收http请求的消息体，就需要将<code>filebeat.yml</code>中的<code>output.console</code> 放开，其他的<code>output</code> 先注释掉，然后就能在日志文件 <code>filebeat.log</code>中看到发出的消息了。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yml" data-lang="yml"><span style="color:#204a87;font-weight:bold">output.console</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">pretty</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">true</span></code></pre></div>
<p>可以看到，单条filebeat输出的消息的格式如下：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json"><span style="color:#000;font-weight:bold">{</span>
  <span style="color:#204a87;font-weight:bold">&#34;@timestamp&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;2021-06-12T07:45:42.298Z&#34;</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;@metadata&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;beat&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;filebeat&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;type&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;_doc&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;version&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;7.13.2&#34;</span>
  <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;ecs&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;version&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;1.8.0&#34;</span>
  <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;host&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;name&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;dmn202106110726&#34;</span>
  <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;agent&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;type&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;filebeat&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;version&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;7.13.2&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;hostname&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;dmn202106110726&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;ephemeral_id&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;7d859dc2-8e0c-46df-91e0-b1094f284624&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;id&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;551dddd3-6a61-4fdb-a5b6-6ca0c8c0f7e7&#34;</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;name&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;dmn202106110726&#34;</span>
  <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;log&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;file&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
      <span style="color:#204a87;font-weight:bold">&#34;path&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;/usr/local/myapp/logs/threadPoolMonitorLog.log&#34;</span>
    <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
    <span style="color:#204a87;font-weight:bold">&#34;offset&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">410823</span>
  <span style="color:#000;font-weight:bold">}</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;message&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;[2021-06-25 15:45:39.598] [INFO] [ThreadPoolMoniter-pool-17-thread-2] threadPoolMonitorLog 68 [151] - 线程池: ContactLabelUpdate-pool-22-thread-java.util.concurrent.ThreadPoolExecutor@2d32ac7f[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]&#34;</span><span style="color:#000;font-weight:bold">,</span>
  <span style="color:#204a87;font-weight:bold">&#34;input&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span>
    <span style="color:#204a87;font-weight:bold">&#34;type&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;log&#34;</span>
  <span style="color:#000;font-weight:bold">}</span>
<span style="color:#000;font-weight:bold">}</span></code></pre></div>
<p>​        也就是说，我们的接收filebeat的springboot项目要接收的消息就是上面代码这样的格式。在我们的接收filebeat消息的应用搭建跑起来以后，将<code>output.console</code>注释掉，改为<code>output.http</code></p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yml" data-lang="yml"><span style="color:#204a87;font-weight:bold">output.http</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">url</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;http://mydomain.com/info-direct&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">max_retries</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">0</span></code></pre></div>
<p>​       配置好以后，重启filebeat，然后我的web应用就接收到 filebeat发送来的消息体了，然后转换为公司内部的日志采集流程中的kafka消息格式进行发送。然后日志采集到磁盘和es都可以正常了。本来觉得已经没问题了，然后就检查一下日志是否正常吧，不检查还好，一检查完蛋。过了一小时了，日志还是1小时前的，感觉是不是有延迟啊，然后就等到第二天，我的老天，日志在昨天的那个时间点转呢，就一分钟的消息怎么都转不出来了，而且消息的时间是乱的，就是有的在前面有的在后面。然后看filebeat的日志，就是一直有一个<code>retries</code>的消息，因为我的 <code>output.http</code>的配置已经配置了<code>max_retires:0</code>了，所以我感觉应该不会重试了吧，不会吧，不会吧。</p>

<div  align="center"><img src="https://wejack639.oss-cn-beijing.aliyuncs.com/blogimages/img/1624608873757-20210625161432.png" width = 300 /> </div>

<p>​        然后我就排查了公司的日志采集的流程，很完美，没有瑕疵。难道是filebeat发消息的顺序是乱的？然后我有在阿里云服务器上面增加了一个springboot项目，来用http接收filebeat的http类型的output，结果也是顺序的。然后我就懵了，咋回事哦，filebeat的顺序也是对的，输出也很实时，为啥转发过来就延迟了那么长时间一致在1分钟那里转了呢？然后我就把阿里云服务器上面增加的springboot的日志和公司内网的springboot项目的日志都下载下来，从头按顺序往下翻，翻着翻着，您猜怎么着，感觉好多的日志都似曾相识，用<code>sublimtext</code>把似曾相识的日志给匹配一下，渥的老哥，您再猜怎么着，循环了，一看到循环，就联想到retry，他这个就是不断的retry了，所以就循环了。</p>

<p>​       然后我就排查为什么filebeat会retry，看到了一个文章，找不到链接了，filebeat的消息发送是顺序的，消息发送成功的判定很简单，只要请求返回的状态是200就可以了，返回值是什么无所谓（这个是看 beats-output-http源码了解的），其实这个问题看filebeat输出的日志就能看出来，日志里面有timeout的字样，因为一开始就把这个给排除掉了，所以因为这个绕了三天的弯路。那么既然超时了，我们就要设置超时时间，我将超时时间设置为2000ms，然后日志就正常能够往后输出了。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-fallback" data-lang="fallback">queue:
  mem:
    events: 10240
    flush.min_events: 2048
    flush.timeout: 5s</code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yml" data-lang="yml"><span style="color:#204a87;font-weight:bold">output.http</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#f8f8f8;text-decoration:underline">	</span><span style="color:#8f5902;font-style:italic"># 输出的请求地址</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">url</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#4e9a06">&#39;http://mydomain.com/info-direct&#39;</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">max_retries</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">0</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># 请求超时时间，这个很重要，默认是100</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#204a87;font-weight:bold">response_header_timeout</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">2000</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># Specifies the amount of time in milliseconds to wait for a server&#39;s response</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># headers after fully writing the request (including its body, if any).</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># This time does not include the time to read the response body.</span><span style="color:#f8f8f8;text-decoration:underline">
</span><span style="color:#f8f8f8;text-decoration:underline">  </span><span style="color:#8f5902;font-style:italic"># default=100ms</span></code></pre></div>
<p>​        完结散花~~~~ 开玩笑的，当然没有了。虽然日志能继续往后刷了，但是刷的很慢，于是我加了一个请求次数统计，一统计，不得了，每分钟才能处理三十多次，好家伙，filebeat的消息发送是顺序的，刚刚我们说过了，需要前一条发送acked了，然后才能接着处理下一条，这瓶颈不就卡在了我这个应用上面了吗，虽然平均请求时间也就20ms，还没算网络传输的时间，这样每秒也就能处理50条啊，一分钟也就3000条，课时我们阿里云上面的应用，每秒就能产生数百条的日志，这个http请求处理的效率肯定不够，怎么办，只能在阿里云再增加一个springboot应用，快速的处理filebeat发出的请求，将消息缓冲，凑够几百条以后，在批量发给公司的应用进行批量循环处理发送，以缩短网络传输的时间了。就这么一弄，果然ok了，日志刷新是准实时的了。这会是真的完结散花了。</p>

<blockquote>
<p>参考文档：
Filebeat 采集日志到 Kafka 配置及使用
<a href="https://lihuimintu.github.io/2019/08/05/Filebeat-Kafka/">https://lihuimintu.github.io/2019/08/05/Filebeat-Kafka/</a>
Centos安装Filebeat
<a href="https://blog.csdn.net/jeikerxiao/article/details/84841792">https://blog.csdn.net/jeikerxiao/article/details/84841792</a>
filebeat kafka配置整理
<a href="https://blog.csdn.net/qq_41926119/article/details/104510481">https://blog.csdn.net/qq_41926119/article/details/104510481</a>
filebeat官方文档
<a href="https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html">https://www.elastic.co/guide/en/beats/filebeat/current/configuring-howto-filebeat.html</a>
linux查看环境变量
<a href="https://www.php.cn/linux-416847.html">https://www.php.cn/linux-416847.html</a>
go下载慢问题
<a href="https://blog.csdn.net/qq_43442524/article/details/104900180">https://blog.csdn.net/qq_43442524/article/details/104900180</a>
filebeat 源码编译安装
<a href="https://www.cnblogs.com/dyh004/p/9673615.html">https://www.cnblogs.com/dyh004/p/9673615.html</a>
beats-output-http
<a href="https://github.com/crazygreenpenguin/beats-output-http">https://github.com/crazygreenpenguin/beats-output-http</a>
mac生成linux下可执行的.go二进制文件
<a href="https://blog.csdn.net/qq_37133717/article/details/84030814">https://blog.csdn.net/qq_37133717/article/details/84030814</a>
使用KafkaMagic查看kafka的消息内容
<a href="https://blog.csdn.net/lwlfox/article/details/104625366">https://blog.csdn.net/lwlfox/article/details/104625366</a>
java发送kafka消息
<a href="https://blog.csdn.net/wobuaizhi/article/details/80950337">https://blog.csdn.net/wobuaizhi/article/details/80950337</a>
<a href="https://blog.csdn.net/u013144287/article/details/76277295">https://blog.csdn.net/u013144287/article/details/76277295</a></p>
</blockquote>

    </div>
    <footer class="post-footer">
     

     <div class="post-nav">
    <div class="post-nav-next post-nav-item">
    
        <a href="http://www.shutdown.cn/post/k8s/" rel="next" title="">
        <i class="fa fa-chevron-left"></i> 
        </a>
    
    </div>

    <div class="post-nav-prev post-nav-item">
    
        <a href="http://www.shutdown.cn/post/libc.so.6-version-glibc_2.14-not-found%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3/" rel="prev" title="">
         <i class="fa fa-chevron-right"></i>
        </a>
    
    </div>
</div>
      
     
     
     






    </footer>
  </article>
</section>

          </div>
        </div>
        <div class="sidebar-toggle">
  <div class="sidebar-toggle-line-wrap">
    <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
  </div>
</div>
<aside id="sidebar" class="sidebar">
  <div class="sidebar-inner">

    <section class="site-overview sidebar-panel  sidebar-panel-active ">
      <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
        src="http://www.shutdown.cn/img/author.jpg"
        alt="不与天斗Domino" />
    <p class="site-author-name" itemprop="name">不与天斗Domino</p>
    <p class="site-description motion-element" itemprop="description"> 
        Programmer &amp; Architect</p>
</div>
      <nav class="site-state motion-element">
    <div class="site-state-item site-state-posts">
      <a href="http://www.shutdown.cn/post/">
        <span class="site-state-item-count">172</span>
        <span class="site-state-item-name">日志</span>
      </a>
    </div>
    <div class="site-state-item site-state-categories">    
        <a href="http://www.shutdown.cn/categories/">      
         
        <span class="site-state-item-count">10</span>
        
        <span class="site-state-item-name">分类</span>
        
        </a>
    </div>

    <div class="site-state-item site-state-tags">
        <a href="http://www.shutdown.cn/tags/">
         
        <span class="site-state-item-count">96</span>
        
        <span class="site-state-item-name">标签</span>
        </a>
    </div>
</nav>
      
      

      

      <div class="links-of-blogroll motion-element inline">
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=&amp;m=0&amp;s=220&amp;c=ff0000&amp;cr1=ffffff&amp;f=arial&amp;l=33&amp;bv=35" async="async"></script>
</div>

    </section>
    
  </div>
</aside>

      </div>
    </main>
   
    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  <span itemprop="copyrightYear">  &copy; 
  2013 - 2022</span>
  <span class="with-love"><i class="fa fa-heart"></i></span>
  <span class="author" itemprop="copyrightHolder">天地维杰网</span>
  <span class="icp" itemprop="copyrightHolder"><a href="https://beian.miit.gov.cn/" target="_blank">京ICP备13019191号-1</a></span>
</div>
<div class="powered-by">
  Powered by - <a class="theme-link" href="http://gohugo.io" target="_blank" title="hugo" >Hugo v0.63.2</a>
</div>
<div class="theme-info">
  Theme by - <a class="theme-link" href="https://github.com/xtfly/hugo-theme-next" target="_blank"> NexT
  </a>
</div>


      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
      <span id="scrollpercent"><span>0</span>%</span>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/fastclick/lib/fastclick.min.js?v=1.0.6"></script> 
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="http://www.shutdown.cn/js/vendor/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>

<script src="http://www.shutdown.cn/js/vendor/fancybox/jquery.fancybox.pack.js?v=2.1.5"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/utils.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/motion.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/affix.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/schemes/pisces.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/scrollspy.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/post-details.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/toc.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/bootstrap.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$','$'] ],
      displayMath: [ ['$$','$$'] ],
      processEscapes: true
    },
    "HTML-CSS": { fonts: ["TeX"] }
  });
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML' async></script>
</body>
</html>